//
//  UserInfoManager.swift
//  GreatART
//
//  Created by zhangheng on 2018/4/11.
//  Copyright © 2018年 www.Dayishu.com. All rights reserved.
//

import Foundation
//import SwiftProgressHUD

class UserInfoManager: NSObject {
    
    public static let shared = UserInfoManager()
    
    ///////////////////////////////////
    
    var shareLink: String?{
        get {return UserDefaults.standard.string(forKey: "USER_shareLink")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_shareLink")
            UserDefaults.standard.synchronize()
        }
    }
    
    var lang: String?{
        get {return UserDefaults.standard.string(forKey: "USER_lang")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_lang")
            UserDefaults.standard.synchronize()
        }
    }
    
    var name: String?{
        get {return UserDefaults.standard.string(forKey: "USER_name")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_name")
            UserDefaults.standard.synchronize()
        }
    }
    
    var noAutoCheck: Bool?{
        get {return UserDefaults.standard.bool(forKey: "USER_noAutoCheck")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_noAutoCheck")
            UserDefaults.standard.synchronize()
        }
    }
    
    var lastAonnouce: String?{
        get {return UserDefaults.standard.string(forKey: "USER_lastAonnouce")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_lastAonnouce")
            UserDefaults.standard.synchronize()
        }
    }
    
    //0:会议模式 1:互动模式
    var scene: Int?{
        get {return UserDefaults.standard.integer(forKey: "USER_scene")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_scene")
            UserDefaults.standard.synchronize()
        }
    }
   
    var ownid: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ownid")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ownid")
            UserDefaults.standard.synchronize()
        }
    }
    
    var ownidKey: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ownidKey")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ownidKey")
            UserDefaults.standard.synchronize()
        }
    }
    
    //直播功能是否开通
    var hasLivePermiss: Bool?{
        get {return UserDefaults.standard.bool(forKey: "USER_hasLivePermiss")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_hasLivePermiss")
            UserDefaults.standard.synchronize()
        }
    }
    
    //声音图标提示
    var isAudioVolume: Bool?{
        get {return UserDefaults.standard.bool(forKey: "USER_isAudioVolume")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_isAudioVolume")
            UserDefaults.standard.synchronize()
        }
    }
    
    //网路质量提示
    var isNETTip: Bool?{
        get {return UserDefaults.standard.bool(forKey: "USER_isNETTip")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_isNETTip")
            UserDefaults.standard.synchronize()
        }
    }
   
    
    func removeForKey(key:String) -> (){
        UserDefaults.standard.removeObject(forKey: key)
        UserDefaults.standard.synchronize()
    }
}

//MARK:-壹会网
extension UserInfoManager {
    var yhwownidKey: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ownidKey")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ownidKey")
            UserDefaults.standard.synchronize()
        }
    }
    var yhwownid: String?{
        get {return UserDefaults.standard.string(forKey: "USER_yhwownid")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_yhwownid")
            UserDefaults.standard.synchronize()
        }
    }
}
